www.gusucode.com > 一个美化窗口实例 VC++漂亮界面源码程序 > 一个美化窗口实例 VC++漂亮界面/其它可以引用的类源码/VC++菜单类的演示/PrintFrame.cpp

    // PrintFrame.cpp : implementation file
//

#include "stdafx.h"
#include "PrintFrame.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CPrintFrame

IMPLEMENT_DYNCREATE(CPrintFrame, CFrameWnd)

CPrintFrame::CPrintFrame()
{
	m_pCallerDlg = NULL;
	m_pWnd		= AfxGetApp()->m_pMainWnd;
	AfxGetApp()->m_pMainWnd = this;
}
CPrintFrame::~CPrintFrame()
{
}
BEGIN_MESSAGE_MAP(CPrintFrame, CFrameWnd)
	//{{AFX_MSG_MAP(CPrintFrame)
	ON_WM_DESTROY()
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CPrintFrame message handlers

BOOL CPrintFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext) 
{
	// TODO: Add your specialized code here and/or call the base class
	m_pView = new CPrintView();
	m_pView->Create(NULL,NULL,WS_CHILD|WS_VISIBLE,CRect(0,0,0,0),this,AFX_IDW_PANE_FIRST,pContext);
	return TRUE;
}

void CPrintFrame::OnDestroy() 
{
	if(m_pView!=NULL)
	{
		m_pView->DestroyWindow();
	}
	CFrameWnd::OnDestroy();
	AfxGetApp()->m_pMainWnd = m_pWnd;
}